package router

import (
	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
	"worklog/docs"
	"worklog/service"
)

func Router() *gin.Engine {
	r := gin.Default()
	docs.SwaggerInfo.BasePath = ""
	//swag 相关
	r.GET("swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	//index 主页
	r.GET("/index", service.Index)
	//user 模块
	r.GET("/user", service.GetUser)
	r.POST("/user", service.CreateUser)
	//message 模块
	r.GET("/message", service.GetMessage)
	r.POST("/message", service.CreateMessage)
	return r
}
